﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OrderWizard.aspx.cs" Inherits="Shop.Web.OrderWizard" %>
<%@ Register TagPrefix="ctrl" TagName="AddresList" Src="~/Controls/Ajax/AddresList.ascx" %>
<%@ Register TagPrefix="ctrl" TagName="Addres" Src="~/Controls/Addres.ascx" %>
<asp:Content ID="contentPath" runat="server" ContentPlaceHolderID="prePathContent" >
    <asp:Literal runat="server" id="ltPrePath"></asp:Literal></asp:Content>
<asp:Content runat="server" id="currentPath" ContentPlaceHolderID="pathContent">
<asp:Literal runat="server" id="ltCurPath"></asp:Literal>
</asp:Content>
<asp:Content runat="server" id="afterPath" ContentPlaceHolderID="afterPathContent">
<asp:Literal runat="server" id="ltAfterPath"></asp:Literal>
</asp:Content>
<asp:Content ID="contentMain" runat="server" ContentPlaceHolderID="mainContent" >
<asp:Literal runat="server" id="ltHelp">Для оформления заказа вам необходимо войти в систему или зарегистрироваться.</asp:Literal><br /><br />
<asp:PlaceHolder runat="server" id="phRegisterOrLogin" visible="false">
    Я уже зарегистрирован.
    <table width="100%" cellpadding="2" cellspacing="0">
        <tr >
            <td align="center">e-mail</td>
            <td><asp:TextBox runat="server" ID="tbEmail" Width=120></asp:TextBox></td>
        </tr>
        <tr>
            <td align="center">пароль</td>
            <td><asp:TextBox runat="server" ID="tbPasswrd" TextMode="Password" Width=120></asp:TextBox></td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td><input type="checkbox" checked="checked" id="chbRemeberMe" runat="server"/> запомнить меня </td>
        </tr>
    </table>
    <a class="dialog_link" path="#register" title="Регистрация" >Я хочу зарегистрироваться</a>
    <div class="fright" style="width:50%"><asp:Button runat="server" id="btnStep0" Text="Продолжить" OnClick="btnStep0_Click"/></div>
</asp:PlaceHolder>
<asp:PlaceHolder runat="server" id="phAdmin" visible="false">
<asp:DropDownList runat="server" id="ddlCustomers" Visible="false"  Width="300"></asp:DropDownList>&nbsp; <asp:Button runat="server" id="btnChangeCustomer" Text="Оформить заказ для пользователя" OnClick="btnChangeCustomer_Click" Visible="False"/><br />
</asp:PlaceHolder>

<asp:PlaceHolder runat="server" id="phProductList" visible="false">
<div class="filter ui-corner-all" runat="server" id="divProduct">
<asp:GridView runat="server" id="gridProduct" AllowPaging="true" AllowSorting="true" PageSize="10" AutoGenerateColumns="false" SkinID="filter_content" OnRowDataBound="gridProduct_DataBound">
    <Columns> 
        <asp:TemplateField>
            <HeaderTemplate></HeaderTemplate>
            <ItemTemplate>
            <asp:HiddenField id="orderItemId" runat="server" Value='<%# DataBinder.Eval(Container, "DataItem.Id")%>'/>            
            <img src="images/Product/thumb_IMG<%# DataBinder.Eval(Container, "DataItem.Product.Group.Id")%>.jpg"/>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
        <HeaderTemplate>Описание</HeaderTemplate>
            <ItemTemplate>
                <%# DataBinder.Eval(Container, "DataItem.Product.BrandArt")%><br />
                <a href="Product.aspx?id=<%# DataBinder.Eval(Container, "DataItem.Product.Group.Id")%>"><%# DataBinder.Eval(Container.DataItem, "Product.Name")%></a><br />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <HeaderTemplate>Цена</HeaderTemplate>
            <ItemTemplate><%# DataBinder.Eval(Container, "DataItem.Product.Price","{0:C}")%></ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <HeaderTemplate>Я хочу...</HeaderTemplate>
            <ItemTemplate>
                <span runat="server" class="pseudo" id="btnChangeSize" ><span class="ui-icon ui-icon-info fleft"></span>&nbsp;изменить размер</span><br />
<%--                <asp:CheckBox id="chbAdd" runat="server" Checked='<%# DataBinder.Eval(Container, "DataItem.AddSize")%>' Text=" уточнить размер"></asp:CheckBox><br />--%>
                <span class="pseudo" id="btnDelOrderItem" OnClick="DeleteOrderItem('<%# DataBinder.Eval(Container, "DataItem.Id")%>')" ><span class="ui-icon ui-icon-circle-close fleft"></span>&nbsp;удалить :(</span>
                </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>  
 <div class="total ui-corner-bottom fright">Итого: <asp:Literal runat="server" id="ltItog"></asp:Literal></div>
</div><br />
 
 <script>
function GetHTML()
 {
    var url = 'AjaxPages/OrderProductList.aspx<%= preorder ? "?preorder=true" : "" %>';
    $("#<%= divProduct.ClientID %>").load(url, {}, function () {$("#drft").load("AjaxHtmlContent.aspx?content=Draft", {}, function() { $("#draft .tooltip").tooltip(); });});
    
 }
</script>
</asp:PlaceHolder>
<asp:PlaceHolder runat="server" id="phEditOrderList" visible="false">
    <asp:PlaceHolder id="phDiscount" visible="false" runat="server">
        Ваша скидка: <asp:Literal runat="server" id="ltDiscount"></asp:Literal>
        <br />Итого с учетом скидки: <asp:Literal runat="server" id="ltItogWithDiscount"></asp:Literal>
    </asp:PlaceHolder>
     <div class="fright"><asp:Button runat="server" id="btnStep1" Text="Продолжить" OnClick="btnStep1_Click"/></div>
</asp:PlaceHolder>
<asp:PlaceHolder runat="server" ID="phNoItems" Visible="false">
К сожалению, вы пока ничего не заказали :( Может быть, подберете что-нибудь в <a href="Catalog.aspx">каталоге</a>?
</asp:PlaceHolder>
</asp:PlaceHolder>
<asp:PlaceHolder runat="server" id="phSpecs" visible="false">

<div class="addres_list">
Выберите адрес доставки, чтобы мы могли предложить вам варианты оплаты и доставки.
<ctrl:AddresList id="ctrlAddresList" runat="server"></ctrl:AddresList>
<div class="dialog" id="addres" onscroll="SaveAddr()">
    <ctrl:Addres runat="server" ID="adrMain" />
</div>
</div>
<div class="delivery_type"></div>
<div class="payment_type"></div>
<div class="fright"><%--<asp:Button runat="server" id="btnStep2_back" Text="Назад" OnClick="btnStep2_back_Click"/>--%>
<input type="button" id="btnConfirmAddres" Value="Продолжить" class="default-button ui-corner-all" onclick="SetAddr()"/>
<input type="button" id="btnConfirmDelivery" Value="Продолжить" class="default-button ui-corner-all" onclick="SetDelivery()" style="display:none;"/><asp:Button runat="server" id="btnStep2" Text="Продолжить" OnClick="btnStep2_Click" Visible="false"/></div>
 <script>
 function SetAddr() {
          $.post("AjaxHtmlContent.aspx?Content=SetAddresToOrder",
                   {    addrId: $('#hdnAddr').val()
                    }, 
                   function(data){
                    $(".addres_list").hide();
                    $(".delivery_type").html(data);
                    $("#btnConfirmAddres").hide()
                    $("#btnConfirmDelivery").show()
                   } 
                   );}

 function SetDelivery() {
          $.post("AjaxHtmlContent.aspx?Content=SetDeliveryToOrder",
                   {    deliveryId: $('#hdnDelType').val()
                    }, 
                   function(data){
                    if (data == "1")
                    {
                        <%= ClientScript.GetPostBackEventReference(btnStep2, String.Empty) %>
                    }
                   } 
                   );}

 
                   
</script>

</asp:PlaceHolder>
<asp:PlaceHolder runat="server" id="phMegaSubmit" visible="false">
Ваш заказ:<br />
<asp:Literal runat="server" id="ltMegaItog"></asp:Literal>
<%--<asp:Button runat="server" id="btnStep3_back" Text="Назад" OnClick="btnStep3_back_Click"/>--%>
<div class="fright"><asp:Button runat="server" id="btnMegaSubmit" Text="Подтвердить заказ" OnClick="btnMegaSubmit_Click"/></div>
</asp:PlaceHolder>
</asp:Content>
